//引入工具函数
import request from '@/utils/request'

export const checkLoginReq = data => {
    //返回axios接口调用结果
    return request({
      method: 'post',
      url: '/users/checkLogin',
      data,
    })
  }

  //检测重复接口函数
export const checkUserRepeatReq = data => {
    //返回axios接口调用结果
    return request({
      method: 'post',
      url: '/users/repeat',
      data,
    })
  }
  

  //添加接口函数
export const addUserReq = data => {
    //返回axios接口调用结果
    return request({
      method: 'post',
      url: '/users/add',
      data,
    })
  }

  //获取用户列表接口
export const getUserListReq = params => {
    return request({
      method: 'get',
      url: '/users/list',
      params,
    })
  }

  export const del = params => {   //单个账号删除
    return request({
      method: 'get',
      url: '/users/del',
      params,
    })
  }



  export const accadd = data => {
    //返回axios接口调用结果
    return request({
      method: 'post',
      url: '/users/add',
      data,
    })
  }


//修改接口函数
export const editUserReq = data => {
  //返回axios接口调用结果
  return request({
    method: 'post',
    url: '/users/edit',
    data,
  })
}

// delAll 全部删除

export const delAll = data => {
  //返回axios接口调用结果
  return request({
    method: 'post',
    url: '/users/batchdel',
    data,
  })
}

//获取用户详情
export const getUserInfoReq = () => {
  return request({
    method: 'get',
    url: '/users/info',
  })
}



//修改用户头像
export const updateUserAvatarReq = params => {
  return request({
    method: 'get',
    url: '/users/avataredit',
    params,
  })
}

//获取分类列表
export const goodsCate = params => {
  return request({
    method: 'get',
    url: '/goods/catelist',
    params,
  })
}

//删除分类列表
export const CategoryDeletion = params => {
  return request({
    method: 'get',
    url: '/goods/delcate',
    params,
  })
}


export const accountAdd = data => {
  //分类添加
  return request({
    method: 'post',
    url: '/goods/addcate',
    data,
  })
}

export const accountAddx = data => {
  //分类添加
  return request({
    method: 'post',
    url: '/goods/add',
    data,
  })
}


//商品列表获取
export const goodsList = params => {
  return request({
    method: 'get',
    url: '/goods/list',
    params,
  })
}



//商品列表删除
export const goodsListDel = params => {
  return request({
    method: 'get',
    url: '/goods/del',
    params,
  })
}

//检查旧密码是否正确
export const checkoldpwd = params => {
  return request({
    method: 'get',
    url: '/users/checkoldpwd',
    params,
  })
}

//修改新密码
export const editpwd = data => {
  return request({
    method: 'post',
    url: '/users/editpwd',
    data,
  })
}

//店铺详情
export const shop = params => {
  return request({
    method: 'get',
    url: '/shop/info',
    params,
  })
}


//获取首页数据
export const totaldata = () => {
  return request({
    method: 'get',
    url: '/order/totaldata',
  })
}